package com.example.demo.controller;
import com.example.demo.Service.IDeepSeekService;
import com.example.demo.commom.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/deepseek")
public class ChatController {

   @Autowired
   @Qualifier("deepSeekServiceImpl")
   private IDeepSeekService deepSeekService;

    @PostMapping("/send")
    public Result<?> send(@RequestBody Map<String, String> requestBody) {
        // 从 JSON 请求体中获取 query 字段
        String query = requestBody.get("query");
        // 打印获取的书名
        log.info("用户输入了：{}，触发ai效果", query);

        // 调用业务逻辑处理方法并返回推荐结果
        return Result.success(deepSeekService.generateResponse(query));
    }


}